//
//  String+Extension.swift
//  BTE
//
//  Created by Mike Zhang on 2025/8/26.
//

import UIKit

extension String {
    
    func URL_Pre() -> URL? {
        guard var components = URLComponents(string: self) else { return nil }
        let suffixQueryItems = BTEUrlToolsManager.shared.urlInfo().map {
            URLQueryItem(name: $0.key, value: $0.value.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed))
        }
        components.queryItems = (components.queryItems ?? []) + suffixQueryItems
        return components.url
    }
    
}
